package cn.taoticket.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.taoticket.mapper.TaoticketItemMapper;
import cn.taoticket.pojo.TaoticketItem;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by taoticket
 */
@RestController
public class RestTaoticketItemService {

    @Resource
     private TaoticketItemMapper taoticketItemMapper;

     @RequestMapping(value = "/getTaoticketItemById",method = RequestMethod.POST)
     public TaoticketItem getTaoticketItemById(@RequestParam("id") Long id)throws Exception{
        return taoticketItemMapper.getTaoticketItemById(id);
     }

     @RequestMapping(value = "/getTaoticketItemListByMap",method = RequestMethod.POST)
     public List<TaoticketItem>	getTaoticketItemListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketItemMapper.getTaoticketItemListByMap(param);
     }

     @RequestMapping(value = "/getTaoticketItemCountByMap",method = RequestMethod.POST)
     public Integer getTaoticketItemCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketItemMapper.getTaoticketItemCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddTaoticketItem",method = RequestMethod.POST)
     public Integer qdtxAddTaoticketItem(@RequestBody TaoticketItem taoticketItem)throws Exception{
        taoticketItem.setCreatedTime(new Date());
        return taoticketItemMapper.insertTaoticketItem(taoticketItem);
     }

     @RequestMapping(value = "/qdtxModifyTaoticketItem",method = RequestMethod.POST)
     public Integer qdtxModifyTaoticketItem(@RequestBody TaoticketItem taoticketItem)throws Exception{
        taoticketItem.setUpdatedTime(new Date());
        return taoticketItemMapper.updateTaoticketItem(taoticketItem);
     }
}
